import mockRequest from "@/utils/mockRequests";

export interface MyExerciseAll {
    cover: string;
    id: string;
    isDelete: number;
    planName: string;
    contentName?: string;
    planId?: string;
    status: string;
    useUserSpace?: number;
    weekTrainedDuration: number;
    weeklyPlanDuration?: number;
}

export interface Statistics {
    creator: string;
    totalTrainingUserCount: number;
    totalTrainedDuration: number;
    planAddCount: number;
    added: number;
    createMethod: string;
    creatorName: string;
    planName: string;
    creatorAccid: string;
    planCover: string;
    openOutside: number;
    completedCount: number;
    createTime: number;
    totalTrainedCount: number;
    planId: string;
    hasJoined: number;
    creatorAvatar: string;
    contentCount: number;
}
export type AllData = {
    content: MyExerciseAll[];
    first: boolean;
    last: boolean;
    number: number;
    numberOfElements: number;
    offset: any;
    size: string;
    sort: any;
    statistics: Statistics;
    totalElements: number;
    totalPages: number;
    useOffset: boolean;
};

// 历史浏览记录
export interface Creator {
    certificationType: string;
    level: number;
    name: string;
    vipExpireTime: number;
    avatar: string;
    id: string;
    vipGrade: number;
}

export interface Moment {
    cover: string;
    creator: string;
    router: string;
    creatorBackup: Creator;
}
export interface HistoryItem {
    momentSubject: string;
    creator: string;
    createTime: number;
    momentBackup: Moment;
    momentTitle: string;
    updateTime: number;
    id: string;
    momentId: string;
    ischecked:boolean;
}

export type HistoryList = {
    content: HistoryItem[];
    first: boolean;
    last: boolean;
    number: number;
    numberOfElements: number;
    offset: any;
    size: number;
    sort: any;
    statistics: any;
    totalElements: number;
    totalPages: number;
    useOffset: boolean;
};

export default {
    // 练习室全部数据的获取
    getAllData() {
        return mockRequest.get(
            "/eShop/refundOrderFees?access_token=0e606755-5f0d-4cd0-a1da-f0c0cb0f41f1"
        );
    },
    getMyExerciseAll() {
        return mockRequest.get<any, AllData>("/getAllMyData");
    },
    // 获取练习室我创建的数据
    getMyCreate(key: string) {
        return mockRequest.get<any, AllData>(
            `/getMyData/myListCategory=${key}`
        );
    },
    // 历史浏览记录的获取
    getHistoryList() {
        return mockRequest.get<any, HistoryList>("/getHistoryData");
    },
    // 获取练习室详细数据
    getDetailsList(){
        return mockRequest.get<any,AllData>('/getDetails')
    }
};
